/***************************************************************************
 *   Copyleft 2008-2009 by												   *
 *	 Iwanicki Krzysztof													   *
 *   <gamma.mini.pw.edu.pl/~iwanickik>									   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 ***************************************************************************/
#include "../vEngine3D.h"
#include "../State/vStates.h"
#include "../API/vApis.h"

namespace Vendetta {
	vRenderer::vRenderer() {
	}

	vRenderer::~vRenderer() {
	}

	// Begins frame
	vVoid vRenderer::BeginFrame() {
		// Reset whole shading state related stuff
		vEngine3D::InstancePtr()->StatePtr()->Reset();

		//// Set default perspective mode
		//vEngine3D::InstancePtr()->ViewPtr()->SetPerspective(45.0f,		// Viewing angle
		//		vEngine3D::InstancePtr()->MainWindowPtr()->Width() / (vReal) vEngine3D::InstancePtr()->MainWindowPtr()->Height(),	// Aspect ratio
		//		0.5f,		// Near plane
		//		5000.0f);	// Far plane

		// Set rendering rectangle to whole window
		vEngine3D::InstancePtr()->ViewPtr()->SetViewPort(0, 0, vEngine3D::InstancePtr()->MainWindowPtr()->Width(), 
			vEngine3D::InstancePtr()->MainWindowPtr()->Height());
	}


	// Ends frame
	vVoid vRenderer::EndFrame() {
		vEngine3D::InstancePtr()->ApiPtr()->SwapColorBuffers();
	}
}